<template>
    <view class="bg-content">
        <u-popup v-model="isShowActionSheet" mode="bottom" :closeable="true" height="500px">
            <div style="text-align: center; font-size: 20px; margin-top: 20px; margin-bottom: 20px;">
                {{typeName}}促销活动
            </div>
            <div v-if="tbStorePromotion.id">
                <!--赠品-->
                <div v-if="'03,13,23,33,43'.indexOf(tbStorePromotion != null ? tbStorePromotion.type : '') != -1">
                    <!--<u-cell-item :arrow="false" v-for="(item, index) of tbStorePromotion.typeTextList" :key="index">-->
                        <!--<view slot="icon">-->
                            <!--<myImg :obj="item" :sysFile="returnSysFile({fkId: item['result']})"-->
                                   <!--:customStyle="'pointer-events: none; height: 100px;  width:100px; background-size: cover; background-repeat: no-repeat; background-position: center;'"-->
                                   <!--:defaultUrl="'/static/default-image/store-brand.jpg'"-->
                            <!--&gt;</myImg>-->
                        <!--</view>-->
                        <!--<div slot="title" class="skin-font" style="padding: 10px;">-->
                            <!--{{item['typeText']}}-->
                        <!--</div>-->
                    <!--</u-cell-item>-->

                    <view class="taobao" v-for="(item, index) of tbStorePromotion.typeTextList" :key="index">
                        <view class="ticket">
                            <view class="left" style="width: 100%;">
                                <myImg :obj="item" :sysFile="{fkId: item['result']}" class="picture"
                                       :customStyle="'pointer-events: none; height: 100px;  width:100px; background-size: cover; background-repeat: no-repeat; background-position: center;'"
                                       :defaultUrl="'/static/default-image/store-brand.jpg'"></myImg>
                                <view class="introduce" style="padding-left: 20px;">
                                    <view class="top">
                                        {{item['typeText']}}
                                    </view>
                                    <view class="type">{{typeName}}促销活动</view>
                                    <view class="date u-line-1">{{tbStorePromotion.startTime}}-{{tbStorePromotion.endTime}}</view>
                                </view>
                            </view>
                        </view>
                    </view>
                </div>

                <!--非赠品-->
                <div v-if="'03,13,23,33,43'.indexOf(tbStorePromotion != null ? tbStorePromotion.type : '') == -1">
                    <!--<u-cell-item :arrow="false" v-for="(item, index) of tbStorePromotion.typeTextList" :key="item.id">-->
                        <!--<div slot="title" class="skin-font">-->
                            <!--{{item['typeText']}}-->
                        <!--</div>-->
                    <!--</u-cell-item>-->

                    <view class="taobao" v-for="(item, index) of tbStorePromotion.typeTextList" :key="item.id">
                        <view class="ticket">
                            <view class="left" style="width: 100%;">
                                <view class="introduce" style="padding-left: 20px;">
                                    <view class="top">
                                        {{item['typeText']}}
                                    </view>
                                    <view class="type">{{typeName}}促销活动</view>
                                    <view class="date u-line-1">{{tbStorePromotion.startTime}}-{{tbStorePromotion.endTime}}</view>
                                </view>
                            </view>
                        </view>
                    </view>
                </div>
            </div>
        </u-popup>
    </view>
</template>

<script>

    import {TbStorePromotionService} from "../dev/services/tb-store-promotion.service";
    import myImg from './my-img'

    export default {
        data() {
            return {
                typeName: '商品',
                isShowActionSheet: false,
                tbStorePromotion: {
                    typeTextList: []
                }
            }
        },
        components: {
            myImg
        },
        onLoad() {
            const _self = this
        },
        methods: {
            openTbStorePromotion(id, typeName) {
                const _self = this;
                if (typeName) {
                    this.typeName = typeName;
                }
                new TbStorePromotionService().findTbStorePromotionByIdCascade(id).then(result => {
                    _self.tbStorePromotion = result;
                    _self.isShowActionSheet = true
                });
            },
        }
    }
</script>

<style lang="scss" scoped>
    @import "./tb-store-promotion.scss";
</style>
